﻿using System;
using System.Data.SqlClient;

namespace WebApplication1
{
    public partial class NewContract : System.Web.UI.Page
    {
         private string Сon = @"Data Source=LOCALHOST\SQLEXPRESS;Initial Catalog=Test;
Integrated Security=True;Pooling=False";
       
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }
       
        protected void Button4_Click(object sender, EventArgs e)
        {
         SqlConnection connection = new SqlConnection(Сon);
        connection.Open();

        SqlCommand сommand1 = new SqlCommand("insert into Client (PassportSerial,Birth,PassportNumber,Name,Surname,Phone,Email)" +
            "VALUES ('" + Convert.ToInt32(TextBox3.Text) + "','" + TextBox5.Text + "','" + Convert.ToInt32(TextBox4.Text) + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + Convert.ToInt32(TextBox6.Text) + "','" + TextBox7.Text + "')", connection);
        сommand1.ExecuteNonQuery();

        connection.Close();
        Label1.Visible = true;
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox6.Text = "";
        TextBox7.Text = "";
     
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            Server.Transfer("client.aspx");
        }
        

        }
    }

